/**
 * AmqpChatServiceConfiguration.java
 */
package com.tobeface.sns.infrastructure.amqp.config;

import java.io.IOException;

import com.rabbitmq.client.Channel;

/**
 * @author Dylan
 * @time 2012-8-2
 */
public class AmqpChatServerConfiguration extends AmqpConfiguration {

	private final static String TYPE = "direct";
	private final static String KEY = "chatMsgKey";
	
	public AmqpChatServerConfiguration(){
		
	}
	/* (non-Javadoc)
	 * @see com.sinzv.sns.infrastructure.amqp.AmqpConfiguration#initChannel(com.rabbitmq.client.Channel)
	 */
	@Override
	protected Channel initChannel(Channel channel) {
		try {
			channel.exchangeDeclare(CHAT_EXCHANGE_NAME, TYPE, true);
			channel.queueDeclare(CHAT_QUEUE_NAME, true, false, false, null);
			channel.queueBind(CHAT_QUEUE_NAME,CHAT_EXCHANGE_NAME, KEY);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return channel;
	}
	
	public String getExchangeName(){
		return CHAT_EXCHANGE_NAME;
	}
	public String getQueueName(){
		return CHAT_QUEUE_NAME;
	}
	public String type(){
		return TYPE;
	}
	public String key(){
		return KEY;
	}

}
